//
//  MainViewController.m
//  VmiSJ
//
//  Created by 汪的一声就哭了！ on 2017/1/22.
//  Copyright © 2017年 汪的一声就哭了！. All rights reserved.
//

#import "MainViewController.h"

@interface MainViewController ()

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    RWMainViewController *viewC1 = [[RWMainViewController alloc] init];
    MyNavigationController *nav1 = [[MyNavigationController alloc] initWithRootViewController:viewC1];
    nav1.tabBarItem.title = @"任务";
    nav1.tabBarItem.image = [UIImage imageNamed:@"任务"];
    nav1.tabBarItem.selectedImage = [UIImage imageNamed:@"任务选中"];
    
    MessageViewController *viewC2 = [[MessageViewController alloc] init];
    MyNavigationController *nav2 = [[MyNavigationController alloc] initWithRootViewController:viewC2];
    nav2.tabBarItem.title = @"消息";
    nav2.tabBarItem.image = [UIImage imageNamed:@"消息"];
    nav2.tabBarItem.selectedImage = [UIImage imageNamed:@"消息选中"];
    
    MineViewController *viewC3 = [[MineViewController alloc] init];
    MyNavigationController *nav3 = [[MyNavigationController alloc] initWithRootViewController:viewC3];
    nav3.tabBarItem.title = @"我的";
    nav3.tabBarItem.image = [UIImage imageNamed:@"我的"];
    nav3.tabBarItem.selectedImage = [UIImage imageNamed:@"我的选中"];
    
    self.viewControllers = @[nav1,nav2,nav3];
    self.tabBar.tintColor = Color;
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showNotification:) name:@"Notification" object:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)showNotification:(NSNotification *)noti{
    [self setSelectedIndex:1];
    XXZXXQViewController *viewC = [[XXZXXQViewController alloc] init];
    [viewC setHidesBottomBarWhenPushed:YES];
    [self.selectedViewController.navigationController pushViewController:viewC animated:YES];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"showNotification" object:self userInfo:noti.userInfo];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
